﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using A2DFramework.EventService.Configuration;

namespace A2DFramework.EventService
{
    struct EventProcessorInfo
    {
        public string FullClassType { get; set; }
        public string EventProcessorType { get; set; }
    }

    internal static class EventProcessorHandlerSearcher
    {
        /// <summary>
        /// 根据事件类Type返回相应的处理器Type
        /// </summary>
        /// <param name="eventClassType"></param>
        /// <returns></returns>
        public static EventProcessorInfo Find(string eventClassType)
        {
            var result = from tb in EventServiceConfiguration.EventMappings
                         where tb.Event.Equals(eventClassType)
                         select tb;

            EventMapping em=result.FirstOrDefault();

            EventProcessorInfo info = new EventProcessorInfo();
            info.EventProcessorType=em.EventProcessorType;
            info.FullClassType=em.EventFullType;
            return info;
        }
    }
}
